fix: resolve GitLab "Not Found" error in comment deletion#167
Merged
jeeyo merged 3 commits intocodeleague:mainfrom Jul 3, 2025
Merged
fix: resolve GitLab "Not Found" error in comment deletion#167jeeyo merged 3 commits intocodeleague:mainfrom
jeeyo merged 3 commits intocodeleague:mainfrom
Conversation
- Add comprehensive error handling for 404 errors in GitLabMRService - Replace Promise.all with individual error handling in GitLabAdapter - Add graceful handling of stale comment/discussion IDs - Enhance logging for partial deletion failures - Add extensive unit tests for error scenarios - Install missing @gitbeaker dependencies for proper API support Fixes issue where stale comment IDs caused entire comment cleanup to fail with 'Not Found' error, preventing successful GitLab integration.
jeeyo
previously approved these changes
Jul 2, 2025
Contributor
Author
🔧 CI Pipeline Fix AppliedI've fixed the yarn lockfile issue that was causing the CI pipeline to fail: ProblemSolution Applied✅ Removed corrupted yarn.lock - The original lockfile had syntax errors Result
The PR is now ready for CI validation! 🚀 |
24f3654 to
295c9f2
Compare
- Add @types/glob@^7.2.0 and @types/minimatch@^3.0.5 to resolve TypeScript compilation errors - Update yarn.lock with new dependencies - Ensure GitLab MR Service uses proper types from @gitbeaker/core - All tests passing (131/131) - Build successful with TypeScript strict mode
- Fixed all TypeScript 'any' type annotations to proper types - Removed unused imports and functions - Reduced cognitive complexity in GitLabMRService.deleteDiscussion method - Fixed prettier formatting issues - Updated interface types to match implementation - All tests passing and linting clean
jeeyo
approved these changes
Jul 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The GitLab integration was failing with a "Not Found" error during comment cleanup, causing the entire VCS reporting to fail. This occurred when the
removeExistingCommentsfunctionality attempted to delete stale comment/discussion IDs that were no longer valid.Error message:
Root Cause
@gitbeaker/restpackage was missing from dependenciesSolution
🔧 GitLabMRService.ts
deleteNoteWithErrorHandling()method with comprehensive 404 error handlingdeleteDiscussion()with try-catch blocks for missing discussionsPromise.allSettled()with ES2015-compatible sequential processing🔧 GitLabAdapter.ts
Promise.all()with individual error handling for each deletion🔧 GitLab.spec.ts
📦 package.json
@gitbeaker/coreand@gitbeaker/restdependenciesKey Features
✅ 404 Error Resilience: System continues processing even when individual comments/discussions are not found
✅ Partial Failure Handling: Logs warnings for failed deletions but continues with successful ones
✅ ID Validation: Validates IDs before attempting deletion operations
✅ Detailed Logging: Provides clear feedback on success/failure ratios
✅ Backward Compatibility: No breaking changes to existing functionality
Testing
Files Changed
package.json- Added missing GitBeaker dependenciessrc/Provider/GitLab/GitLab.spec.ts- Added comprehensive error handling testssrc/Provider/GitLab/GitLabAdapter.ts- Enhanced error handling and loggingsrc/Provider/GitLab/GitLabMRService.ts- Added 404 error resilienceImpact
This fix resolves the GitLab "Not Found" error completely, ensuring reliable comment management and preventing integration failures due to stale comment references.